//
//  ZTY_TableBarViewController.swift
//  WaiBao
//
//  Created by 赵佟越 on 17/5/11.
//  Copyright © 2017年 zhaotongyue. All rights reserved.
//

import UIKit
import SVProgressHUD
import UIKit

class ZTY_TableBarViewController: UITabBarController {

    var tabBarBgImg:UIImageView?
    var tabBarBgImgSelected:UIImageView?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        /*
         * 更改tabBar选中按钮的颜色
         */
        //        self.tabBar.tintColor = UIColor.redColor()
        
        self.setUpAllChildViewController()
    }
    
    
    func setUpAllChildViewController() {
        
        self.setUpOneChildViewController(viewController: firstViewController(), image: UIImage.init(named: "人")!, selectedImage: UIImage.init(named: "人")!, title: "首页")
        
        self.setUpOneChildViewController(viewController: SecondViewController(), image: UIImage.init(named: "人")!, selectedImage: UIImage.init(named: "人")!, title: "第二页")
        
        self.setUpOneChildViewController(viewController: ThirdViewController(), image: UIImage.init(named: "人")!, selectedImage: UIImage.init(named: "人")!, title: "第三页")
        
        self.setUpOneChildViewController(viewController: FourViewController(), image: UIImage.init(named: "人")!, selectedImage: UIImage.init(named: "人")!, title: "我的")
    }
    
    
    func setUpOneChildViewController(viewController: UIViewController, image: UIImage, selectedImage: UIImage, title: NSString) {
        
        let navVC = UINavigationController.init(rootViewController: viewController)
        
        // 让图片显示图片原始颜色  “UIImage” 后+ “.imageWithRenderingMode(.AlwaysOriginal)”
        navVC.tabBarItem = UITabBarItem.init(title: title as String, image: image, selectedImage: selectedImage.withRenderingMode(.alwaysOriginal))
        tabBar.tintColor = UIColor.init(getColor: "0B4278")
        
        self.addChildViewController(navVC)
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    /*
     // MARK: - Navigation
     
     // In a storyboard-based application, you will often want to do a little preparation before navigation
     override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
     // Get the new view controller using segue.destinationViewController.
     // Pass the selected object to the new view controller.
     }
     */
    
}
